<?php
/**
 * @version 0.8.3 2010-10-07
 * @package Joomla
 * @subpackage LeagueResults
 * @copyright (C)  2008, 2009, 2010 Henryk Drozd
 * @license GNU/GPL, see LICENSE.php
 * LeagueResults is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License 2
 * as published by the Free Software Foundation.

 * LeagueResults is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */


defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view');


class lrViewSeason extends JView {

	function display($tpl = null)
	{
		global $mainframe;

		// Load pane behavior
		jimport('joomla.html.pane');
		JHTML::_('behavior.tooltip');

		//initialise variables
		$editor 	= & JFactory::getEditor();
		$document	= & JFactory::getDocument();
		$pane		= & JPane::getInstance('sliders');
		$user 		= & JFactory::getUser();
		$settings	= lrAdmin::config();

		//get vars
		$cid 			= JRequest::getInt( 'cid' );

		//add css and js to document
		$document->addScript('../includes/js/joomla/popup.js');
		$document->addStyleSheet('../includes/js/joomla/popup.css');

		// Get data from the model
		$model		= & $this->getModel();
		$row      	= & $this->get( 'Data');


		//create the toolbar
		if ( $cid ) {
			//set the submenu
		JSubMenuHelper::addEntry( JText::_( 'COMPONENT NAME' ), 'index.php?option=com_lr');
		JSubMenuHelper::addEntry( JText::_( 'SEASONS' ), 'index.php?option=com_lr&view=seasons', true);
		JSubMenuHelper::addEntry( JText::_( 'TEAMS' ), 'index.php?option=com_lr&view=teams');
		JSubMenuHelper::addEntry( JText::_( 'CLUBS' ), 'index.php?option=com_lr&view=clubs');
		JSubMenuHelper::addEntry( JText::_( 'PLAYERS' ), 'index.php?option=com_lr&view=players');
		JSubMenuHelper::addEntry( JText::_( 'TABLECONTENTS' ), 'index.php?option=com_lr&view=tablecontents');
		if ($user->get('gid') > 24) {
			JSubMenuHelper::addEntry( JText::_( 'SETTINGS' ), 'index.php?option=com_lr&view=settings&task=edit');
			}
		}
		JToolBarHelper::title( '<img src="components/com_lr/assets/images/lr1.jpg" height="30" width="75" alt="League Results Logo" valign="middle" /> '. JText::_( 'EDIT SEASON' ), 'seasonsedit' );
		JToolBarHelper::apply();
		JToolBarHelper::spacer();
		JToolBarHelper::save();
		JToolBarHelper::spacer();
		JToolBarHelper::cancel();
		JToolBarHelper::spacer();
	//	JToolBarHelper::help( 'lr.editplayers', true );

		JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'description' );

	
		JHTML::_('behavior.modal', 'a.modal');

		$pointslogic = & $this->get( 'Pointslogic');
	
		$logiclist 	= array();
		$logiclist[] 	= JHTML::_('select.option', '0', JText::_( 'SELECT POINTS LOGIC' ) );
		$logiclist 	= array_merge( $logiclist, $pointslogic );
		
		$Lists = array();
		$Lists['pointslogic'] = JHTML::_('select.genericlist', $logiclist, 'pointslogictype', 'size="1" class="inputbox"', 'text', 'text', $row->pointslogictype );
		

		$comp_types = array();
		$comp_types[] = JHTML::_('select.option', 'LEAGUE', JText::_('LEAGUE'));
		$comp_types[] = JHTML::_('select.option', 'ELIMINATION', JText::_('ELIMINATION'));
		$comp_types[] = JHTML::_('select.option', 'TOURNAMENT', JText::_('TOURNAMENT'));

		$comp_types_list 	= array();
		$comp_types_list[] = JHTML::_('select.option', '0', 
				JText::_( 'SELECT COMPETITION TYPE' ) );
		$comp_types_list 	= array_merge( $comp_types_list, $comp_types );

		
		$Lists['competition_types'] = JHTML::_('select.genericlist', $comp_types_list,
		 'competition_type', 'size="1" class="inputbox"', 'value', 'text', $row->competition_type);
		
		$this->assignRef('Lists'      	, $Lists);
		
		
		//assign data to template
		$this->assignRef('row'      	, $row);
		$this->assignRef('pane'      	, $pane);
		$this->assignRef('editor'      	, $editor);
		$this->assignRef('settings'     , $settings);
		$this->assignRef('imageselect' 	, $imageselect);

		parent::display($tpl);
		
	}
}
?>